package org.infosys.basic.config;

import org.infosys.basic.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @Description: 登录拦截配置类
* @Author: hank
* @Version: 1.0
* @Date:  2022/7/7 18:39
*/
@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**") // 拦截路径
                .excludePathPatterns("/login/**") // 放行路径
                .excludePathPatterns("/verifyCode/**")
                .excludePathPatterns("/fastdfs/**")
                .excludePathPatterns("/shop/settlement")
                .excludePathPatterns("/register/**");
    }
}
